<template>
	<cl-select-table
		v-model="value"
		:title="t('选择注册二维码')"
		:service="service.qrcode.qrcode"
		:columns="columns"
		:multiple="multiple"
        :dict="{ text: 'qrLongName', value: 'id' }"
	/>
</template>

<script setup lang="ts">
defineOptions({
	name: 'qrcode-select'
});

import { ref, useModel } from 'vue';
import { useCool } from '/@/cool';
import { useI18n } from 'vue-i18n';
import { useBase } from '/$/base';
import { useDict } from '/$/dict';

const props = defineProps({
	modelValue: null,
	multiple: Boolean
});

const { service } = useCool();
const { t } = useI18n();
const { dict } = useDict();
const { user } = useBase();

const value = useModel(props, 'modelValue');

const columns = ref([
		// id
		{
			label: t('ID'),
			prop: 'id',
			minWidth: 100
		},
		// 达人名称
		{
			label: t('销售名称'),
			prop: 'adminName',
			minWidth: 100
		},
		// 达人名称
		{
			label: t('达人名称'),
			prop: 'daren',
			minWidth: 100
		},
		{
			label: t('渠道'),
			prop: 'channelId',
			formatter: (row, column, cellValue) => {
				const val = dict.get('Channel').value.find(item => item.value === cellValue);
				return val ? val.label : cellValue;
			},
			minWidth: 100
		}
]);
</script>
